package personal.hrsw.mybatisplusdemo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import personal.hrsw.mybatisplusdemo.domain.Course;
import personal.hrsw.mybatisplusdemo.service.CourseService;
import personal.hrsw.mybatisplusdemo.mapper.CourseMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【course】的数据库操作Service实现
* @createDate 2025-04-24 09:27:23
*/
@Service
public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course>
    implements CourseService{
    @Autowired
    CourseMapper courseMapper;
    @Override
    public List<Course> findAll() {
        return courseMapper.selectAll();
    }

    @Override
    public int remove(int id) {
        return courseMapper.deleteById(id);
    }

    @Override
    public int add(Course course) {
        return courseMapper.insert(course);
    }

    @Override
    public Course findById(int id) {
        return courseMapper.selectById(id);
    }

    @Override
    public int edit(Course course) {
        return courseMapper.update(course);
    }

    @Override
    public List<Course> findByPage(int pageNo, int pageSize) {
        return courseMapper.selectByPage((pageNo-1)*pageSize, pageSize);
    }
}




